<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      width: 300px;
      height: 40px;
      background-color: rgb(215, 166, 166);
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <div id="app">
    <input type="text" v-model="inputTxt">
    {{ inputTxt }}
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        inputTxt: '你好世界',
        
      },
      
      // config新增watch属性
      watch: {
        // 侦听完整侦听器  对象
        inputTxt: {
          // 侦听器函数
          handler(newVal, oldVal){
            console.log('侦听器触发值是', newVal);
          },
          immediate: true
        }
      }
    })
  </script>
</body>
</html>